Previous Book Contents Book Index Next

Inside Macintosh: Mac OS 8 Toolbox Reference /
Chapter 5 - Menu Manager Reference / Menu Manager Functions
Defining Your Own Contextual Menu Plug-In /


HandleSelection

NEW WITH CONTEXTUAL MENUS

Executes the contextual menu item chosen by the user. If you write a contextual menu plug-in, it must contain a HandleSelection method with the following form:

OSStatus HandleSelection(AEDesc* inContextDescriptor, 
                     SInt32 inCommandID);
inContextDescriptor
The context chosen by the user. This data is the same as that passed in the inContextDescriptor parameter for the ExamineContext method. The Menu Manager passes this in the form of a pointer to an Apple Event descriptor. See Inside Macintosh: Interapplication Communication for information about the form of this descriptor.
inCommandID
A long integer assigned to the chosen menu item via the keyContextualMenuCommandID descriptor, passed in by the Menu Manager.
method result
A result code. See "Result Codes" for a list of possible values. If this value is not noErr then the Menu Manager does not use the plug-in in this case. However, it will call HandleSelection again the next time an action is selected.
DISCUSSION
If one of the plug-in's menu items is chosen, the Menu Manager calls the plug-in's HandleSelection method to execute the action. The plug-in should then perform the appropriate action.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
8 JAN 1998